#pragma once
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <omp.h>
#include "frame.h"
using namespace std;
using namespace cv;
typedef  tuple<vector< DMatch >, vector< DMatch >, vector<KeyPoint>, vector<KeyPoint> > match_return;
class orb_matcher {
public:
	orb_matcher(const std::string& filename);
	int update_mats(Mat a, Mat b);
	match_return match(Mat img_1, Mat img_2,Mat forbiden_Zone, double min_dist, double max_dist);
	//tuple<vector<KeyPoint>, vector<KeyPoint>, Mat, Mat>match(Mat img_1, Mat img_2, double min_dist,double max_dist);
	int match(frame* Frame ,double min_dist, double max_distt, Mutex* frame_lock);


private:
	vector<KeyPoint> keypoints_1, keypoints_2;
	Mat descriptors_1, descriptors_2;
	Mat img_match;
	Mat img_goodmatch;
	Ptr<FeatureDetector> detector;
	Ptr<DescriptorExtractor> descriptor;
	Ptr<DescriptorMatcher> matcher;
	tuple<vector< DMatch >, vector< DMatch >, vector<KeyPoint>, vector<KeyPoint> > result;
	tuple<vector< DMatch >, vector< DMatch >, vector<KeyPoint>, vector<KeyPoint> > old_result;
};